package Action;

import java.util.HashMap;
import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

import Model.book;
import Service.bookService;


public class BookPageSelectAction extends ActionSupport{
	private HashMap<String,Object> dataMap;
	private List<book> bookList;
	private int size=10;
	public List<book> getUserList() {
		return bookList;
	}
	public void setUserList(List<book> bookList) {
		this.bookList = bookList;
	}
	public HashMap<String, Object> getDataMap() {
		return dataMap;
	}
	
	public void setDataMap(HashMap<String, Object> dataMap) {
		this.dataMap = dataMap;
	}
	//ajax请求页
	public String Pager(){
		dataMap = new HashMap<String,Object>();
		bookService pager = new bookService();
		int count = pager.getBookCount();
		String req = ServletActionContext.getRequest().getParameter("need");
		Integer value = new Integer(req);
		int need = value.intValue();
		List list = pager.pageSelectService(need, size);
		dataMap.put("booklist",list);
		dataMap.put("size", size);
		dataMap.put("count", count);
		return SUCCESS;
	}

	

}
